package com.xsir.ditan.miniprogram.vo;

import com.xsir.ditan.miniprogram.entity.OrderGoods;
import lombok.Data;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author user
 * @date 2021/2/10
 */
@Data
public class OrderMiniVo {
    private String orderNum;
    private String createTime;
    private String goodsName;
    private String goodsImage;
    private List<String> dateList;
    private BigDecimal price;
    private String status;
    
    public OrderMiniVo(OrderGoods orderGoods) {
        orderNum = orderGoods.getId();
        createTime = orderGoods.getDate();
        goodsImage = orderGoods.getGoodsImage();
        goodsName = orderGoods.getGoodsName();
        String[] dateListStr = orderGoods.getDateList().split("\\|");
        dateList = new ArrayList<>();
        dateList.addAll(Arrays.asList(dateListStr));
        price = orderGoods.getPrice();
        status = orderGoods.getStatus() == 0 ? "未支付" : "paid";
    }
    
}
